﻿// aboutdlg.h : interface of the CAboutDlg class
//
/////////////////////////////////////////////////////////////////////////////

#pragma once

#include "SiraCtrl_i.h"
#include <comutil.h>
class CAboutDlg : public CDialogImpl < CAboutDlg >
{
public:
	enum { IDD = IDD_ABOUTBOX };

	BEGIN_MSG_MAP( CAboutDlg )
		MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )
		COMMAND_ID_HANDLER( IDOK, OnCloseCmd )
		COMMAND_ID_HANDLER( IDCANCEL, OnCloseCmd )
	END_MSG_MAP()

	// Handler prototypes (uncomment arguments if needed):
	//	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	//	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
	//	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

	LRESULT OnInitDialog( UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/ )
	{
		CenterWindow( GetParent() );

		//CoInitialize( NULL );
		CLSID clsid = { 0 };
		if ( SUCCEEDED( CLSIDFromProgIDEx( L"Sira.Ctrl", &clsid ) ) )
		{
			CComPtr<ISiraControl> pSiraCtrl;//智能指针    
			pSiraCtrl.CoCreateInstance( clsid );
			VARIANT_BOOL ret;
			pSiraCtrl->ExportAllDocumentsForOffline( L"AA.ZIP", &ret );
		}
		//CoUninitialize();
		return TRUE;
	}

	LRESULT OnCloseCmd( WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/ )
	{
		EndDialog( wID );
		return 0;
	}
};
